<%@page import="Entity.User"%>
<%@page import="Entity.Room"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>机房信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha512-SfTiTlX6kk+qitfevl/7LibUOeJWlt9rbyDn92a1DqWOw9vWG2MFoays0sgObmWazO5BQPiFucnnEAjpAB+/Sw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
	<link rel="shortcut icon" type="image/x-icon" href="logo.jpg" />
	<style type="text/css">
		a {
		text-decoration: none;
		}
		body {
	background-image: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%);
}
	</style>
	<script language="javascript"> 
		function openWin(url,name,newWinWidth,newWinHeight){
				var winWidth=screen.width;  //获取屏幕宽度
				var winHeight=screen.height;  //获取屏幕高度
				//获取新窗口距离屏幕左侧的位置
				var left=(winWidth-newWinWidth)/2;  
				//获取新窗口距离屏幕顶部的位置
				var top=(winHeight-newWinHeight)/2;
				window.open(url,name,'width='+newWinWidth+',height='+newWinHeight+',left='+left+',top='+top+',toolbar=no,menubar=no,location=no,status=no');
				//name:弹出窗口的名字,可不填，用''代替
				//toolbar=no 是否显示工具栏。yes为显示
				//menubar=no 是否显示菜单栏。yes为显示
				//location=no 是否显示地址字段。yes为显示
				//status=no 是否添加状态栏。yes为可以
				
			}

	</script> 
  </head>
  
  <body>
  		<%
  			 User user =(User) session.getAttribute("user");
		  	 if(user==null){
		  	 	 request.getRequestDispatcher("login.jsp").forward(request,response);
		  	 }
  			List<Room> rooms =(List<Room>)request.getAttribute("lr");
	  		
  		 %>
    	
    		<!-- 顶部-->
  	<div style="border: 1px;display: block;">
   			<image  src="image/title.png" style="width: 600px;">
   			<a href="personInfor.jsp" class="btn dropdown-toggle"  style="float: right;margin:auto 40px;">
   			<i class="fa fa-user-circle fa-2x"></i>
   			个人信息
	   		 </a>
   	</div>
	<!-- 导航-->
	<div style="float: left;width: 10%;height:90%; bottom:0;display: block;border-radius: 10px;
   		background-image: linear-gradient(to top,#accbee 0%, #e7f0fd 100%);">
   		<ul class="nav nav-pills nav-stacked">
			  <li class="active"><a href="RoomServlet"><img src="image/m_1.png" width="25px" style="margin-right: 5px;">机房信息</a></li>
			  <li><a href="SearchServlet?cpage=1">用户信息</a></li>
				  <li>
					<a type="button" class="btn " data-toggle="collapse" 
					    data-target="#demo" >
					     实验安排
					</a>    
					<div id="demo" class="collapse"  style="text-align: center;
						background-image: linear-gradient(to top, #accbee 0%, #e7f0fd 100%);">
					  <a class="btn " href="class_total.jsp" style="color: white;">课程日历</a>
					 <a class="btn " href="searchCourseServlet?page=1" style="color: white;">查看课程</a>
					</div>
				  <li><a href="EventServlet?page=1">考试/竞赛</a></li>
				  <li><a href="sendmessage">发邮件</a></li>
			</ul>
 	</div>
    		
    		<div style="padding: 40px;width: 85%;float: left;">
    		<table>
   				<tr>
   			
  				<% 
	    			
	    			for(Room room:rooms){
	    		%>
	   				<td width="150px;" height="160px;">
	   				<a style="text-decoration: none;text-align: center;" onclick="openWin('DamageServlet?room_id=<%=room.getRoom_Id() %>','',600,400)"
	   				><img alt="" src="image/电脑.png" width="100px" style="margin: 0 30px;" ><br>
	   				<p><%=room.getRoom_Id() %></p>
	   				<p>机位总数量：<%=room.getPc_Num()%></p>
	   				<p>可用机位：<%=room.getAvaNum()%> </p>
	   				</a>
	   				</td>
	   		
	    		<% 
	    			}
	    		 %>
		    		
		
    		 	</tr>
    		</table>
    		
    		</div>
    		
    	
  </body>
</html>
